"""
公共用法
"""
#登录装饰器
def login(rool):
    def out(func):
        def wapper(*args,**kwargs):
            from core import admin,student,teather
            if rool == "admin":
                if admin.admin_dic["user"]:
                    res = func(*args,**kwargs)
                    return res
                else:
                    print("用户未登录！")
                    admin.login()
            elif rool == "teather":
                if teather.teather_dic["user"]:
                    res = func(*args,**kwargs)
                    return res
                else:
                    print("用户未登录！")
                    teather.login()
            elif rool == "student":
                if student.student_dic["user"]:
                    res = func(*args,**kwargs)
                    return res
                else:
                    print("用户未登录！")
                    student.login()
            else:
                print("此用户没有权限")
        return wapper
    return out